# 创建测试用例类，我们用pytest框架维护运行，所以必须以Test登陆
from api.login_api import ihrmlogin
from commom.assert_tools import commom_assert
import pytest
from commom.get_jsondata import get_json


class TestIhrmlogin:
    # @pytest.mark.parametrize("mobile,pwd,status_code,success,code,msg",
    #                          [("13800000002", "123456", 200, True, 10000, "成功"),
    #                           ("13800004561", "123456", 200, False, 20001, "错误"),
    #                           ("13800000002", "12345678", 200, False, 20001, "错误")])
    filepath = r'C:\Users\Administrator\Desktop\API_code\ihrm_API_project\data\login_data.json'
    @pytest.mark.parametrize("mobile,pwd,status_code,success,code,msg",get_json(filepath))
    def test01_login(self, mobile, pwd, status_code, success, code, msg):
        resp = ihrmlogin().login(mobile, pwd)
        print("登陆成功响应数据为:", resp.json())
        commom_assert(status_code, success, code, msg, resp)

